<?php
/**

 //  The DoYouHaoBaby PHP FrameWork - page
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //	 | (C) 2010 - 2011 http://doyouhaobaby.net All rights reserved.
 //	 | This is not a free software, use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //	 | page Index控制器
 //  +---------------------------------------------------------------------

*/

!defined('DYHB_PATH') && exit;

class IndexController extends Controller{


	/**
	 * 首页 < 默认访问 >
	 *
	 * @access public
	 * @return void
	 */
    public function index(){

    	$oModel = FormModel::F();

        // 获取总记录数
    	$nTotalRecord = $oModel->all()
    	                ->getCount( );

		$nEveryNum=5;// 每页数量

		// 使用分页类
		$oPage = Page::RUN( $nTotalRecord,$nEveryNum, Safe::getGpc( G::C('PAGE_VAR_NAME') ) );
		$sPageNavbar = $oPage->P( );

		// 获取数据列表
		$arrObjectList = $oModel
			       ->all()
			       ->order( 'form_id DESC' )
			       ->limit( $oPage->returnPageStart( ), $nEveryNum )
			       ->query();

		$this->assign( 'sPageNavbar',$sPageNavbar );
    	$this->assign( 'arrObjectList',$arrObjectList );

		$this->display( );

    }

}
